package com.study.queue;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FanoutMqConfig {

    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("study.fanout2");
    }

    @Bean
    public Queue fanoutQueue() {
        return new Queue("study.fanout");
    }
    @Bean
    public Binding fanoutBinding(Queue fanoutQueue, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(fanoutQueue).to(fanoutExchange);
    }


    @Bean
    public Queue fanoutQueue3() {
        return new Queue("study.fanout3");
    }
    @Bean
    public Binding fanoutBinding2() {
        return BindingBuilder.bind(fanoutQueue3()).to(fanoutExchange());
    }

}
